home *** CD-ROM | disk | FTP | other *** search
- Path: lrz-muenchen.de!news
- From: watzka@stat.uni-muenchen.de (Kurt Watzka)
- Newsgroups: comp.lang.c
- Subject: Re: Pointers to register
- Date: 18 Mar 1996 21:49:42 GMT
- Organization: Leibniz-Rechenzentrum, Muenchen (Germany)
- Distribution: world
- Message-ID: <4iklpm$28s@sparcserver.lrz-muenchen.de>
- References: <1239@altheim.win-uk.net>
- NNTP-Posting-Host: sun2.lrz-muenchen.de
-
- broldham@altheim.win-uk.net (Brian R. Oldham) writes:
-
- >A couple of weeks ago someone posted the opinion that all objects in
- >memory must have an address, which might have gone uncontested but for
- >the fact that he added that therefore all pointers must point to an
- >address. Someone else reminded us that registers don't have an address.
-
- >Bearing in mind the usual way to assign a pointer:
-
- > ptr = &var;
-
- >is correct for objects in memory, but how do you assign a pointer
- >to a register?
-
- >The following function (a getch() for x86) works: But is it right??
- >
- >/* Read next keystroke */
- >#include <dos.h>
-
- >#define KEYBD 0x16
-
- >static union REGS inregs, outregs;
-
- >void getkey(int *scancode, char *ch)
- >{
- > inregs.h.ah = 0x00;
- > int86(KEYBD,&inregs,&outregs);
-
- You use two structs that are members of a union to communicate with
- a function that knows how to deal with them. This does not mean that
- you are "taking the address of a register".
-
- "inregs" and "outregs" are variables in your program. Try:
-
- {
- union REGS foo, bar, baz, bam;
- }
-
- Those variables are in no way related to any registers.
-
- Kurt
- --
- | Kurt Watzka Phone : +49-89-2180-6254
- | watzka@stat.uni-muenchen.de
- | ua302aa@sunmail.lrz-muenchen.de
-
-
-
-
-
-
-
-